Purpose
The string includes task searches an input variable for a predefined value and returns 'true' if the value is found, or 'false' if the value is not found.
Note: The string includes task is case sensitive.
Potential Use Case
You could use this task if you need to scan an email list for the word 'unsubscribe' and execute a process to remove that email address from a database.
Properties
| Incoming | Type | Description |
|---|---|---|
str |
String | Required. The string to search. |
searchString |
String | Required. The string to search for within str. This is case sensitive. |
position |
Number | Optional. The character position within str to begin the search. The character position count begins at 0 (zero), which is the default. This parameter is useful if the searchString is known to appear more than once in the str, and you only need to verify the existence of the second or third instance, etc. |
| Outgoing | Type | Description |
|---|---|---|
result |
Boolean | Returns true if the searchString is found anywhere within the given string; returns false if not. |
Examples
Example 1
In this IAP example:
The
strvariable has been statically coded as12 Dollars And 43 Cents.The
searchStringvariable to search for isCents.The
positionnumber to begin searching within the string has been statically coded as19.The
resultwill befalse, which means no instance of thesearchStringoccurs starting from position 18 of thestrvariable (starting at position 19, thestrvalue reads "ents").
Example 2
In this IAP example:
The
strvariable has been statically coded as12 Dollars And 43 Cents.The
searchStringvariable to search for iscents.The
positionnumber to begin searching within the string has been statically coded as18.The
resultwill befalsebecause thesearchStringis case sensitive ("Cents" is not equal to "cents").
Example 3
In this IAP example:
The
strvariable has been statically coded as12 Dollars And 43 Cents.The
searchStringvariable to search for isCents.The
positionvariable has been left blank (thereby defaulting to0).The
resultwill betruebecause thesearchString("Cents") does appear within thestrvariable.